package theJVMTuning;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Jamie Nie
 * @Date: 2021/6/25 11:06
 * @Slogan: The harder you work, the more luck you have.
 * @desc: 设置内存溢出自动导出dump文件(内存很大的时候 ， 可能会导不出来)
 * -XX:+HeapDumpOnOutOfMemoryError
 * -XX:HeapDumpPath=./   （路径）
 */
public class OOMTest {
    byte[] bytes = new byte[20 * 1024];

    //// -Xms10M -Xmx10M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\jvm.dump
    public static void main(String[] args) throws InterruptedException {
        List<OOMTest> list = new ArrayList<>();
        while (true){
            list.add(new OOMTest());
            Thread.sleep(5);
        }
    }
}
